package com.mycom.service.impl;

import com.mycom.dao.UserFormDao;
import com.mycom.pojo.UserForm;
import com.mycom.service.UserFormService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserFormServiceImpl implements UserFormService {
    @Autowired
    private UserFormDao userFormDao;

    @Override
    public boolean save(UserForm userForm) {
        return userFormDao.save(userForm)>0 ? true : false;
    }

    @Override
    public List<UserForm> findByIdCardNumber(String idCardNumber) {
        return userFormDao.findByIdCardNumber(idCardNumber);
    }

    @Override
    public boolean deleteByFormNumber(String formNumber) {
        return userFormDao.deleteByFormNumber(formNumber)>=0 ? true : false;
    }

    @Override
    public UserForm findByFormNumber(String formNumber) {
        return userFormDao.findByFormNumber(formNumber);
    }

    @Override
    public boolean deleteMany(String[] formNumbers) {
        return userFormDao.deleteMany(formNumbers)>=0 ? true : false;
    }

//    @Override
//    public List<UserSaveItem> findByIdCardNumber(String idCardNumber) {
//        List<UserSaveItem> userSaveItems = userSaveItemDao.findByIdCardNumber(idCardNumber);
////        for (UserSaveItem userSaveItem : userSaveItems) {
////            Date saveDate = new Date(userSaveItem.getSaveDate().getTime());
////            Date workDate = new Date(userSaveItem.getWorkDate().getTime());
////            userSaveItem.setSaveDate(saveDate);
////            userSaveItem.setWorkDate(workDate);
////        }
//        return userSaveItems;
//    }
//
//    @Override
//    public boolean deleteByFormNumber(String formNumber) {
//        return false;
//    }
//
//    @Override
//    public UserForm findByFormNumber(String formNumber) {
//        return null;
//    }
//
//    @Override
//    public boolean deleteByFormId(String formId) {
//        return userSaveItemDao.deleteByFormId(formId) >=0 ? true:false;
//    }
//
//    @Override
//    public UserSaveItem findByFormId(String formId) {
//        return userSaveItemDao.findByFormId(formId);
//    }
//
//    @Override
//    public boolean deleteMany(String[] formIds) {
//        return userSaveItemDao.deleteMany(formIds) >=0 ? true : false;
//    }
}
